
             
/**
 * 
 *
 * @File name:  QueryTFixedAssetsAction.java 
 * @Create on:  2011-10-31 17:00:07
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        
package com.boho.estates.check.action;

            
import java.sql.Connection;
import java.util.List;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.po.DynaBeanMap;
import cn.boho.framework.po.Pager;
import cn.boho.framework.service.MessageService;

import com.boho.common.Constant;
import com.boho.estates.check.dao.AdjustDao;

public class QueryPYandPKAction extends ActionImp {
	
	private Pager pager=null;
	private int pageSize = 100;
	private int currentPage = 1;
	private Connection con=null;
	private String checkNo;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		atx.setErrorContext("BOHO_COMMON_1004", MessageService.getMessage("BOHO_COMMON_1004"),"【盘盈盘亏信息】" ,ex);
	}
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		
		String departIds  = (String)atx.getSessionValue(Constant.SESSION_DEPART_ARRAY);
		
		List pylist = AdjustDao.queryPYList(con, checkNo, departIds);
		List pklist = AdjustDao.queryPKList(con, checkNo, departIds);
		
		DynaBeanMap pydbm = AdjustDao.getPYSum(con, checkNo, departIds);
		DynaBeanMap pkdbm = AdjustDao.getPKSum(con, checkNo, departIds);
		
		DynaBeanMap status = AdjustDao.getCheckStatus(con, checkNo);
		
		atx.setValue("PY_LIST", pylist.toArray());
		atx.setValue("PK_LIST", pklist.toArray());
		atx.setObjValue("PY_COUNT", pydbm.get("PY_COUNT") == null ? 0 : pydbm.get("PY_COUNT"));
		atx.setObjValue("PK_COUNT", pkdbm.get("PK_COUNT") == null ? 0 : pkdbm.get("PK_COUNT"));
		atx.setStringValue("STATUS", status == null ? "0" : (String)status.get("CHAGE_STATUS"));
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		checkNo = atx.getStringValue("CHECK_NO", "");
		con = atx.getConection();
		return 1;
	}
}
